<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of ExecSqlFunctionclass
 *
 * @author Saulo
 */
final class ExecSqlFunction {   
    //put your code here
    /*
     * executa uma função do bando de dados
     * @param $param = parametro da função
     */
    public static function exec($fucName, $param="") {
        if(is_array($param)){
            foreach ($param as $value) {
                if(is_string($value)){
                    $par[]= "'$value'";
                }
                else if(is_integer($value)){
                    $par[] = $value;
                }
            }
           $parametro = implode(", ", $par);
           return 'SELECT '.$fucName.'('.$parametro.');';
        }else if(is_integer($param)){
            $parametro = $param;
        }else if(is_string($param)){
            $parametro = "'$param'";
        }
        return 'SELECT '.$fucName.'('.$parametro.');';
    }

}
?>
